<template>
  <a-card :bordered="false">

    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline">
        <a-row :gutter="24">
          <a-col :md="4" :sm="8">
            <a-form-item label="标准编号">
              <j-input v-model="queryParam.code" placeholder="请输入标准编号"></j-input>
            </a-form-item>
          </a-col>
          <a-col :md="4" :sm="8">
            <a-form-item label="标准名称">
              <j-input v-model="queryParam.name" placeholder="请输入标准名称"></j-input>
            </a-form-item>
          </a-col>
          <a-col :md="4" :sm="8">
            <a-form-item label="标准类型">
              <a-select v-model="queryParam.type" placeholder="请选择标准类型">
                <a-select-option value="GUO">国标</a-select-option>
                <a-select-option value="HANG">行标</a-select-option>
                <a-select-option value="DI">地标</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button
                icon="reload"
                style="margin-left: 8px"
                type="primary"
                @click="searchReset"
              >重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
<!--    <div class="table-operator" style="border-top: 5px" v-show="false">-->
<!--      <a-button @click="handleAdd" type="primary" icon="plus">添加用户</a-button>-->
<!--      <a-button type="primary" icon="download" @click="handleExportXls('用户信息')">导出</a-button>-->
<!--      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"-->
<!--                @change="handleImportExcel">-->
<!--        <a-button type="primary" icon="import">导入</a-button>-->
<!--      </a-upload>-->
<!--      <a-button type="primary" icon="hdd" @click="recycleBinVisible=true">回收站</a-button>-->
<!--      <a-dropdown v-if="selectedRowKeys.length > 0">-->
<!--        <a-menu slot="overlay" @click="handleMenuClick">-->
<!--          <a-menu-item key="1">-->
<!--            <a-icon type="delete" @click="batchDel" />-->
<!--            删除-->
<!--          </a-menu-item>-->
<!--          <a-menu-item key="2">-->
<!--            <a-icon type="lock" @click="batchFrozen('2')" />-->
<!--            冻结-->
<!--          </a-menu-item>-->
<!--          <a-menu-item key="3">-->
<!--            <a-icon type="unlock" @click="batchFrozen('1')" />-->
<!--            解冻-->
<!--          </a-menu-item>-->
<!--        </a-menu>-->
<!--        <a-button style="margin-left: 8px">-->
<!--          批量操作-->
<!--          <a-icon type="down" />-->
<!--        </a-button>-->
<!--      </a-dropdown>-->
<!--      <j-super-query :fieldList="superQueryFieldList" @handleSuperQuery="handleSuperQuery" />-->
<!--    </div>-->

    <!-- table区域-begin -->
    <div>
      <a-table :columns="columns"
               :dataSource="dataSource"
               :pagination="ipagination"
               @change="handleTableChange"
               bordered
               class="Atable"
               size="default"
      >
      <span slot="type" slot-scope="text, record">
        <span>{{ text === 'GUO' ? '国标' : text === 'HANG' ? '行标' : '地标' }}</span>
      </span>
        <!--      <template #bodyCell="{ column,text }">-->
        <!--            <span v-if="column.dataIndex === 'type'">-->
        <!--              <span>{{ text === 'GUO' ? '国标' : text === 'HANG' ? '行标' : '地标' }}</span>-->
        <!--            </span>-->
        <!--      </template>-->
      </a-table>
    </div>

  </a-card>

</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JInput from '@comp/jeecg/JInput'
import { getAction, httpAction } from '@api/manage'

export default {
  name: 'lowCarbonStandardsTable',
  mixins: [JeecgListMixin],
  components: {
    JInput
  },
  data() {
    return {
      loading: '',
      columns: [
        {
          title: '标准编号',
          dataIndex: 'code',
          align: 'left'
          // scopedSlots: { customRender: 'name' },
          // width:420,
        },
        {
          title: '标准名称',
          dataIndex: 'name',
          align: 'left'
        },
        {
          title: '实施日期',
          dataIndex: 'implementationDate',
          align: 'center'
        },
        {
          title: '发布日期',
          dataIndex: 'releaseDate',
          align: 'center'
        },
        {
          title: '标准类型',
          dataIndex: 'type',
          align: 'center',
          scopedSlots: {
            customRender: 'type'
          }
        }
      ],
      url: {
        list: '/carbon/demonstrationPilotCarbonStandard/list'
      }
    }
  },
  mounted() {
    // this.getLowCarbonStandard()
  },
  methods: {
    getLowCarbonStandard() {
      getAction('/low-carbon-screen/carbon/demonstrationPilotCarbonStandard/list', {})
        .then((res) => {
          console.log(res.data.result.records)
          if (res.data.result) {
            // tableTitle.value = '全国/本市低碳标准'
            this.lowCarbonData = res.data.result.records
            // this.pagination2.value.total = res.data.result.total
          }
        })
    }

  }
}

</script>

<style lang="stylus" scoped>
.wholeTable {
  background-color #FFFFFF
  //.Atable{
  //  width 96%
  //  margin-left 2%
  //}

  .table-page-search-wrapper {
    width 100%
    padding-left 50px
    padding-top 20px
  }
}

/deep/ .ant-table-pagination {
  margin-right 20px
}
</style>